<?php

namespace Modules\DataAnalysis\Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Modules\DataAnalysis\Entities\Setting;

class DataAnalysisDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();

        // $this->call("OthersTableSeeder");
        // 初始化 settings 表数据
        $settings = [
            [
                'key' => 'collect_user_info',
                'type' => 1,
                'value' => 0
            ],
            [
                'key' => 'collect_comment_reply',
                'type' => 1,
                'value' => 0
            ],
            [
                'key' => 'score_line',
                'type' => 2,
                'value' => 0.7
            ],
            [
                'key' => 'edit_comment_score',
                'type' => 2,
                'value' => 1
            ],
        ];

        foreach ($settings as $value) {
            Setting::query()->firstOrCreate(
                [
                    'key' => $value['key']
                ],
                $value
            );
        }
    }
}
